package com.family.web;

import javax.enterprise.inject.Model;
import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.family.service.FUserService;

@Controller
@RequestMapping("/family-user") 
public class FamilyUserController {

	@Autowired
	private FUserService userService;
	
	@RequestMapping("/login")
	public String login(HttpServletRequest request, @RequestParam("user_account") String account, @RequestParam("password") String password ) {
		Integer isHad = userService.getByUserAndPassword(account, password);
		if(isHad != 1) {
			return "err";
		}
		return "login/login";
	}
	
	@RequestMapping("/test")
	public String test(HttpServletRequest request, Model model ) {
		return "family-user/test";
	}
}
